package com.usian.feign;

import com.usian.CatResult;
import com.usian.PageResult;
import com.usian.fallback.ItemServiceFallBack;
import com.usian.pojo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(value = "usian-item-service",fallbackFactory = ItemServiceFallBack.class)
public interface ItemFeign {

    @RequestMapping("selectItemInfo")
    public TbItem selectItemInfo(@RequestParam Long itemId);

    @RequestMapping("selectTbItemAllByPage")
    public PageResult selectTbItemAllByPagePage(@RequestParam Integer page, @RequestParam Integer rows);

    @RequestMapping("selectItemCategoryByParentId")
    public List<TbItemCat> selectItemCategoryByParentId(@RequestParam Long id);

    @RequestMapping("selectItemParamByItemCatId/{itemCatId}")
    public TbItemParam selectItemParamByItemCatId(@PathVariable Long itemCatId);

    @RequestMapping("insertTbItem")
    public  Integer  insertTbitem(@RequestBody TbItem tbItem, @RequestParam String desc, @RequestParam String itemParams);

    @RequestMapping("preUpdateItem")
    public Map<String,Object> preUpdateItem(@RequestParam  Long ItemId);

    @RequestMapping("updateTbItem")
    public  Integer  updateTbItem(@RequestBody TbItem tbItem,@RequestParam String desc,@RequestParam String itemParams);

    @RequestMapping("deleteItemById")
    public Integer deleteItemById(@RequestParam Long itemId);

    @RequestMapping("selectItemParamAll")
    public PageResult  selectItemParamAll(@RequestParam Integer page,@RequestParam Integer rows);

    @RequestMapping("insertItemParam")
    public int insertItemParam(@RequestParam Long itemCatId,@RequestParam String paramData);

    @RequestMapping("deleteItemParamById")
    public int deleteItemParamById(@RequestParam Long id);

    @RequestMapping("selectItemCategoryAll")
    public CatResult selectItemCategoryAll();

    @RequestMapping("selectItemDescByItemId")
    public TbItemDesc selectItemDescByItemId(@RequestParam Long itemId);

    @RequestMapping("selectTbItemParamItemByItemId")
    public TbItemParamItem selectTbItemParamItemByItemId(@RequestParam Long itemId);
}
